package com.example.rumen;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import java.util.Scanner;

public class Btns extends AppCompatActivity implements View.OnClickListener {

    private Button btn_java;
    private Button btn_python;
/*
*
* */
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_btns);
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
            Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
            return insets;
        });

        /*
         * 实现第一个按钮点击事件，匿名内部类
         *
         * */
        //为什么改button：
      btn_java = findViewById(R.id.button_java);
        btn_java.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(getApplicationContext(), "JAVA", Toast.LENGTH_SHORT).show();//显示提示信息
            }
        });


        btn_python = findViewById(R.id.button_python);
        btn_python.setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {
        Toast.makeText(getApplicationContext(), "py ", Toast.LENGTH_SHORT).show();//显示提
    }


    public void hello(View view){
        Toast.makeText(getApplicationContext(), "hello android ", Toast.LENGTH_SHORT).show();//显示提
    }
}